package 笔试记录.M9day20bilibili;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int row = sc.nextInt();//行
        int col = sc.nextInt();//列
        int[][] arr = new int[row][col];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[0].length; j++) {
                arr[i][j] = sc.nextInt();
            }
        }
        int count = 0;
        for (int i = 0; i < arr[0].length; i++) {
            int up = 0;
            int down = arr.length;
            while (up < down){
                if(arr[up][i] != arr[down][i]) count++;

                up++;
                down--;
            }
        }
        System.out.println(count);
    }
}

